package com.example.photography.Activity.Edit;

import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.devilist.recyclerwheelpicker.SingleWheelPicker;
import com.devilist.recyclerwheelpicker.dialog.WheelPicker;
import com.example.photography.R;
import com.example.photography.common.BaseActivity;
import com.example.photography.util.Util;

import butterknife.BindView;
import butterknife.ButterKnife;

public class Edit_identity extends BaseActivity implements View.OnClickListener,
        WheelPicker.OnPickerListener {


    @BindView(R.id.iv_back)
    ImageView ivBack;
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.tv_save)
    TextView tvSave;
    @BindView(R.id.tv_identify)
    TextView tvIdentify;
    @BindView(R.id.tv_sign)
    TextView tvSign;
    @BindView(R.id.rl_indentity)
    RelativeLayout rlIndentity;

    @Override
    protected void initData() {
        ivBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                removeCurrentActivity();
            }
        });
        rlIndentity.setOnClickListener(this);
        tvSave.setOnClickListener(this);

    }

    @Override
    protected int getLayoutId() {
        return R.layout.edit_identity;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }


    @Override
    public void onClick(View view) {
        if (view == rlIndentity) {
            SingleWheelPicker.instance()
                    .setGravity(Gravity.BOTTOM)
                    .setDefPosition(0)
                    .showAllItem(true)
                    .setResource(R.raw.photo_identity)
                    .setTitle("选择身份")
                    .setPickerListener(this).build()
                    .show(getSupportFragmentManager(), "single");
        } else if (view == tvSave) {
            Util.showToast(Edit_identity.this, "修改成功~");
            removeCurrentActivity();
        }
    }

    @Override
    public void onPickResult(String tag, String... result) {
        switch (tag) {
            case "single":
                Util.showToast(Edit_identity.this, result[0]);
                break;

        }
    }
}
